<%@ include file="/WEB-INF/jsp/taglib.jsp" %>

<jsp:useBean id="actionBean" scope="request" type="com.rupertjones.globalcron.web.EditUserAction" />

<s:layout-render name="/WEB-INF/jsp/layout.jsp" title="Global Cron" subtitle="Edit User">
    <s:layout-component name="body">

    <s:form action="EditUser.action" beanclass="com.rupertjones.globalcron.web.EditUserAction">
        <s:hidden name="user.id"/>
        <s:errors/>

        <h1>Edit User</h1>
        <table class="rounded-corner">
            <tr>
                <td>Full Name</td>
                <td>
                    <s:text name="user.fullName" style="width:240px;"/>
                </td>
            </tr>
            <tr>
                <td>User Name</td>
                <td>
                    <s:text name="user.username" style="width:240px; background-color:#C0C0C0" readonly="true"/>
                </td>
            </tr>
            <tr>
                <td>Password</td>
                <td>
                    <s:password name="user.password" style="width:240px;"/>
                </td>
            </tr>
            <tr>
                <td>Confirm Password</td>
                <td>
                    <s:password name="user.confirmPassword" style="width:240px;"/>
                </td>
            </tr>
            <tr>
                <td colspan="2"><b>Roles</b></td>
            </tr>
            <c:forEach items="${actionBean.user.roles}" var="role" varStatus="loop">
            <tr>
                <td>${role.name}</td>
                <td>
                    <input type="checkbox" name="roles_${loop.index}" value="${role.name}" ${role.checked} style="width:240px;"/>
                </td>
            </tr>
            </c:forEach>
            <tr>
                <td colspan="2"><s:submit name="SaveOrUpdate" value="Save"/></td>
            </tr>
        </table>
    </s:form>

    </s:layout-component>
</s:layout-render>
